#include <bits/stdc++.h>
using namespace std;
const int M = 40000 + 7;
vector<int> v[M];
int te, fe, s, t, f, n, m, x, y;
int p1[M], p2[M], d[M];
void calc(int s, int dis[M])
{
	// 初始化
	for (int i = 1; i <= n; i++)
	{
		dis[i] = n + 1;
	}
	queue<int> Q;
	Q.push(s);
	dis[s] = 0;
	while (!Q.empty())
	{
		int cur = Q.front();
		Q.pop();
		for (int i = 0; i < v[cur].size(); i++)
		{
			int d = v[cur][i];
			if (dis[d] > dis[cur] + 1)
			{
				Q.push(d);
				dis[d] = dis[cur] + 1;
			}
		}
	}
}
int main()
{
	// 读入
	cin >> te >> fe >> s;
	cin >> t >> f >> n >> m;
	for (int i = 0; i < m; i++)
	{
		cin >> x >> y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	// 三个calc函数，把s作为起点的最短路求出来，并存到dis数组里，dfs的过程
	calc(t, p1);
	calc(f, p2);
	calc(n, d);

	if (p1[n] == n + 1 || p2[n] == n + 1)
	{
		cout << -1;
	}
	else
	{
		int res = te * p1[n] + fe * p2[n];
		for (int i = 1; i < n; i++)
		{
			int ans = te * p1[i] + fe * p2[i] + (fe + te - s) * d[i];
			res = min(res, ans);
		}
		cout << res;
	}
	// 统计答案：枚举x

	return 0;
}